<html>
<head>
<!-- <link href=" https://121.123.149.199/MaxisSSO/MaxisStyle.css" rel="stylesheet" type="text/css"> -->
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
<script>
	function loadPage(){
		window.open('CusBillList_v1r00');
	}
</script>
</head>

<%@ page import="com.checkfree.isolutions.customer.persist.*" %>
<%@ page import="com.checkfree.isolutions.statement.*" %>
<%@ page import="com.checkfree.isolutions.statement.persist.*" %>
<%@ page import="com.myebills.ebpsfrontend.cust.controller.*" %>
<%@ page import="com.checkfree.isolutions.property.Properties" %>
<%@ page import="com.checkfree.isolutions.property.PropertiesConfig" %>
<%@ page import="java.util.*" %>
<%@ page import="java.net.*" %>
<%@ page import="java.text.*" %>
<%@ page import="com.myebills.ebpsfrontend.cust.controller.*" %>
<%@ page import="com.myebills.ebpsfrontend.cust.maxis.*" %>
<%@ page import="com.myebills.ebpsfrontend.cust.utils.*" %>

<%@ page import="org.xml.sax.InputSource" %>
<%@ page import="org.w3c.dom.*" %>
<%@ page import="java.io.*" %>
<%@ page import="java.lang.Exception" %>
<%@ page import="javax.xml.parsers.*" %>
<%@ page import="my.com.wsClient.*" %>
<%@ page import="my.com.maxis.dao.*" %>

<body>
<div class="loader">
      <p><img src="images/loader.gif" alt="Loading..." /></p>
</div>
<%
		//Get attribute from session for the logon user
		final EbppxEcsUser ecsu = (EbppxEcsUser) session.getAttribute(EbppxConstants.ECS_USER);
		ecsu.setAccessType("P");
		session.setAttribute(EbppxConstants.ECS_USER, ecsu);
		my.com.maxis.dao.LobOutputDao objOutput = null;

		/*File f = new File("D:/Workspace/Maxis/EBPS/sso/data/response.xml");
		DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
		DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder();
		Document doc = docBuilder.parse(f);

		NodeList nodeList = doc.getElementsByTagName("GetLOBInfo_XMLResult");
		Node root = (Element)nodeList.item(0);

		objOutput = my.com.wsClient.DOMParser.retrieveValue00(root, 1);*/

		if(objOutput!=null){

		// Print output
		System.out.println("....Start print output....");

		System.out.println("Status = " + objOutput.getStatus());
		System.out.println("Error_Code = " + objOutput.getErrCode());
		System.out.println("Error_Msg = " + objOutput.getErrMsg());

		System.out.println("ecsu.getUserId = " + ecsu.getUserId());
		System.out.println("ecsu.getEmail = " + ecsu.getEmail());

			 ArrayList listAcc = objOutput.getAccount();
			 for (int i = 0; i < listAcc.size(); i++) {
				 my.com.maxis.dao.AccountInfoDao objAccInfo = new my.com.maxis.dao.AccountInfoDao();
				 objAccInfo = (my.com.maxis.dao.AccountInfoDao) listAcc.get(i);

				 System.out.println("acctExtID = " + objAccInfo.getAcctExtID());
				 String strOldAccountKey = AcctDetails.getOldAccountKey(objAccInfo.getAcctExtID());
				 ecsu.setAccount(objAccInfo.getAcctExtID());
				 ecsu.setOldAccount(strOldAccountKey);

				 ecsu.setAccessType("S");

				 ArrayList listAccDetails = objAccInfo.getAcctDetails();
				 for (int j = 0; j < listAccDetails.size(); j++) {
					 my.com.maxis.dao.AccountDetailsInfoDao objAccDetailsInfo = new my.com.maxis.dao.AccountDetailsInfoDao();
					 objAccDetailsInfo = (my.com.maxis.dao.AccountDetailsInfoDao) listAccDetails.get(j);


					 System.out.println("MSISDN = " + objAccDetailsInfo.getMsisdn());
					 System.out.println("ServiceStatus = " + objAccDetailsInfo.getServiceStatus());
					 System.out.println("LOB = " + objAccDetailsInfo.getLob());
					 System.out.println("Package = " + objAccDetailsInfo.getPackage());
					 System.out.println("PrinSuppInd = " + objAccDetailsInfo.getPrinSuppInd());
					 System.out.println("PostPreInd = " + objAccDetailsInfo.getPostPreInd());
					 System.out.println("SSOStatus = " + objAccDetailsInfo.getSSOStatus());
					 System.out.println("ecsuMSISDN = " + ecsu.getMsisdn());
					 if(objAccDetailsInfo.getPrinSuppInd().equals("P")){
						 ecsu.setAccessType("P");
					 }
				 }
			 }
			System.out.println("....End print output...."+session);
			session.setAttribute(EbppxConstants.ECS_USER, ecsu);
			response.sendRedirect(response.encodeRedirectURL("CusBillList_v1r00"));
		}else{
			response.sendRedirect(response.encodeRedirectURL("CusBillList_v1r00"));
		}
%>
</body>
</html>